package com.zr.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.CarDao;
import com.zr.model.Car;
import com.zr.model.Func;
import com.zr.model.User;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Repository("carDao")
public class CarDaoImpl<T> extends BaseDaOImpl<T> implements CarDao {
		@Override
		public List<Car> findUserMsg(int page, int rows) {		
			String hql = "from Car";
			Query  query  =  this.getCurrentSession().createQuery(hql);
			query.setFirstResult((page-1)*rows);
			query.setMaxResults(rows);
			List<Car> cars =  query.list();
			return cars;
		}
		@Override
		public long findCarCount() {
			String hql = "select count(*) from Car";
			List<Object>  obj = this.getCurrentSession().createQuery(hql).list();
			return (long) obj.get(0);
		}
	

}
